package cn.daniellee.plugin.ib.storage;

import cn.daniellee.plugin.ib.model.PlayerData;

import java.util.ArrayList;
import java.util.List;

public abstract class Storage {

	List<PlayerData> allPlayerData = new ArrayList<>();

	public List<PlayerData> getAllPlayerData() {
		return allPlayerData;
	}

	public PlayerData getBuildingById(String id) {
		return allPlayerData.stream().filter(item -> item.getId().equals(id)).findFirst().orElse(null);
	}

	public abstract boolean initialize();

	public abstract void refreshCache();

	public abstract void addBuilding(PlayerData playerData);

	public abstract String getNextId();

	public abstract void updateBuilding(String id, String column, String value);

	public abstract void deleteBuilding(String id);
}
